package full

import (
	"context"
	"database/sql"
	"db2s/global"
	"db2s/parDef"
	"time"
)

type (
	Object struct {
		LogSeq    int64
		Schema    string
		Table     string
		MSchema   string
		MTable    string
		Partition string
	}
	SqlFilter struct {
		WhereSql string
		WhereAdd string
	}
	Options struct {
		RowsLimit int
		SqlFilter SqlFilter
		Scn       string
		StopTime  time.Duration
		SqlMode   bool
		TablePx   string
		FixRows   int64
		SqlLogBin bool //是否忽略binlog
	}
	Parameter struct {
		Con     []*sql.DB
		Object  Object
		Options Options
	}
	Full struct {
		Drive      []string
		Role       string
		Join       string
		Parameter  Parameter `json:"parameter"`
		Parameter1 []parDef.Parameter
	}
	Gol struct {
		Drive      []string
		Role       string
		Join       string
		Parameter1 []parDef.Parameter
	}
)
type Posit interface {
	Position(ctx context.Context) (result global.Return, err error)
}
type GolEr interface {
	Posit
}
type SumEr interface {
	Rows(ctx context.Context) (result global.Return, err error)
	Count(ctx context.Context) (result global.Return, err error)
	Sum(ctx context.Context) (result global.Return, err error)
	DataSizeMB(ctx context.Context) (result global.Return, err error)
	IndexSizeMB(ctx context.Context) (result global.Return, err error)
	DataLength(ctx context.Context) (result global.Return, err error)
	AvgRowsSize(ctx context.Context) (result global.Return, err error)
}
type RowsEr interface {
	Prefix(ctx context.Context) (result global.Return, err error) //生成insert into目标端的语句前缀
	ExecDML(ctx context.Context) (result global.Return, err error)
	SelectIdxCol(ctx context.Context) (result global.Return, err error)
	SelectAllCol(ctx context.Context) (result global.Return, err error)
	InsertAllCol(ctx context.Context) (result global.Return, err error)
	StringValueCompare(ctx context.Context) (result global.Return, err error)
	IndexPart(ctx context.Context) (result global.Return, err error)
	SelectRowsSql(ctx context.Context) (result global.Return, err error)
	ReadData(ctx context.Context) (result global.Return, err error)
	ReadMiss(ctx context.Context) (result global.Return, err error)
	InsertSql(ctx context.Context) (result global.Return, err error)
	Insert(ctx context.Context) (result global.Return, err error)
}
